home *** CD-ROM | disk | FTP | other *** search
/ The Utilities Experience / The Utilities Experience - Volume 1.iso / software / programmers / source / 24bitcopper / copper-rbg0.s next >
Text File  |  1978-06-29  |  2KB  |  147 lines

  1. ;+++++ Creating a 24 bits copperlist
  2. ;+++++ Code by Yragael (April 1993)
  3.  
  4.     section prg,code_c
  5.     include "df1:sources/registres.s"
  6.  
  7. ;*************** INDEX FONCTIONS ***************
  8.  
  9. openlib=-552
  10. closelib=-414
  11. allocmem=-198
  12. freemem=-210
  13. permit=-138
  14. forbid=-132
  15.  
  16. ;*************** CONSTANTES ***************
  17.  
  18. starty=45
  19. sizey=180
  20. memory=2+$10000
  21. copsize=sizey*(4+4+4+4+4)+4
  22.  
  23. ;sizey*(4+4+4+4+4) (wait, $0106, $0180, $0106, $0180)
  24. ;4 ($FFFFFFFE)
  25.  
  26. ;*************** PROGRAMME PRINCIPAL ***************
  27.  
  28.     bsr.w init
  29. boucle:
  30.     btst #6,$bfe001
  31.     bne boucle
  32.     bsr fin
  33.     rts
  34.  
  35. ;*************** INITIALISATION ***************
  36.  
  37. init:
  38.  
  39. ;reservation de la memoire copper
  40.  
  41.     move.l $4,a6
  42.     move.l #copsize,d0
  43.     move.l #memory,d1
  44.     jsr allocmem(a6)
  45.     move.l d0,copadr
  46.  
  47. ;creation de la copperlist
  48.  
  49.     move.l copadr,a0
  50.  
  51.     moveq #0,d1
  52.     move.w #starty,d0
  53.     lsl.w #8,d0
  54.     or.w #$01,d0
  55.     move.w #sizey-1,d2
  56. coploop0:
  57.     move.w d0,(a0)+
  58.     addi.w #$0100,d0
  59.     move.w #$FFFE,(a0)+
  60.     move.w #$0106,(a0)+
  61.     move.w #$0000,(a0)+
  62.     move.w #$0180,(a0)+
  63.     move.l d1,d3
  64.     lsr.l #4,d3
  65.     move.l d3,d4
  66.     lsr.l #4,d4
  67.     move.w d4,d5
  68.     lsr.w #4,d5    
  69.     and.w #$000F,d3
  70.     and.w #$00F0,d4
  71.     and.w #$0F00,d5
  72.     or.w d5,d4
  73.     or.w d4,d3
  74.     move.w d3,(a0)+
  75.     move.w #$0106,(a0)+
  76.     move.w #$0200,(a0)+
  77.     move.w #$0180,(a0)+
  78.     move.w d1,d3
  79.     move.l d1,d4
  80.     lsr.l #4,d4
  81.     move.w d4,d5
  82.     lsr.w #4,d5    
  83.     and.w #$000F,d3
  84.     and.w #$00F0,d4
  85.     and.w #$0F00,d5
  86.     or.w d5,d4
  87.     or.w d4,d3
  88.     move.w d3,(a0)+
  89.     addq.l #1,d1
  90.     dbf d2,coploop0
  91.  
  92.     move.l #$FFFFFFFE,(a0)
  93.  
  94. ;modif DMA,...
  95.     
  96.     jsr forbid(a6)
  97.     move.w #$03F0,dmacon        ;couper tous les DMA
  98.     move.l copadr,cop1lch        ;adresse coplist1
  99.     clr.w copjmp1            ;copjump1
  100.     move.w #$86C0,dmacon        ;COPEN et BPLEN et BLTPRI et BLTEN
  101.  
  102.     rts
  103.  
  104. ;*************** WAIT VBL ***************
  105.  
  106. waitvbl:
  107.     cmp.b #$FF,vhposr
  108.     bne waitvbl
  109.     rts
  110.  
  111. ;*************** WAIT BLITTER ***************
  112.  
  113. waitblit:
  114.     btst #14,dmaconr
  115.     bne.b waitblit
  116.     rts
  117.  
  118. ;*************** FIN DE PROGRAMME ***************
  119.  
  120. fin:    
  121.  
  122. ;restaurer les anciennes preferences
  123.  
  124.     move.l $4,a6
  125.     move.l #gfxname,a1
  126.     clr.l d0
  127.     jsr openlib(a6)
  128.     move.l d0,a1        
  129.     move.l 38(a1),cop1lch
  130.     clr.w copjmp1            ;copjump1
  131.     move.w #$83F0,dmacon        ;active tous les DMA
  132.     jsr permit(a6)
  133.  
  134. ;liberation de la memoire copper
  135.  
  136.     move.l copadr,a1
  137.     move.l #copsize,d0
  138.     jsr freemem(a6)
  139.  
  140.     rts
  141.  
  142. ;*************** VARIABLES ***************
  143.  
  144. copadr:        dc.l 0
  145. gfxname:    dc.b "graphics.library",0
  146.     even
  147.